import React from 'react'
import { Form, Input, Select } from 'antd'

const FormItem = Form.Item;
const Option = Select.Option
let StandardForm =  React.createClass({
  handleCheck(rule, value, callback) {
    callback();
  },
  render() {
    const {getFieldProps} = this.props.form;
    const formItemLayout = {
      labelCol: {
        span: 5
      },
      wrapperCol: {
        span: 12
      }
    }
    return (
      <Form horizontal onSubmit={this.handleSubmit} className="ticket-form">
        <FormItem  {...formItemLayout} label="标准级别">
          <Select {...getFieldProps('standardLevel', {initialValue: '极高'})}>
            <Option value="极高">极高</Option>
            <Option value="高">高</Option>
            <Option value="中">中</Option>
            <Option value="低">低</Option>
            <Option value="极低">极低</Option>
          </Select>
        </FormItem>
        <FormItem  {...formItemLayout} label="响应时间" hasFeedback>
          <Input type="text" {...getFieldProps('responseLimit', _.merge(
              {rules: [{required: true, validator: this.handleCheck}]}
            ))} />
        </FormItem>
        <FormItem  {...formItemLayout} label="响应时间单位">
          <Select {...getFieldProps('responseUnit', {initialValue: '小时'})}>
            <Option value="天">天</Option>
            <Option value="小时">小时</Option>
            <Option value="分">分</Option>
          </Select>
        </FormItem>
        <FormItem  {...formItemLayout} label="处理时间" hasFeedback>
          <Input type="text" {...getFieldProps('handleLimit', _.merge(
              {rules: [{required: true, validator: this.handleCheck}]}
            ))} />
        </FormItem>
        <FormItem  {...formItemLayout} label="处理时间单位">
          <Select {...getFieldProps('handleUnit', {initialValue: '小时'})}>
            <Option value="天">天</Option>
            <Option value="小时">小时</Option>
            <Option value="分">分</Option>
          </Select>
        </FormItem>
      </Form>      
    )
  }
})

StandardForm = Form.create()(StandardForm)
export default StandardForm;


